package com.qf.fmall01.controller;

import com.qf.fmall01.service.ProductCommentsService;
import com.qf.fmall01.service.ProductService;
import com.qf.fmall01.vo.ResultVO;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("product")
@CrossOrigin
public class ProductController {

    @Autowired
    private ProductService productService;

    @Autowired
    private ProductCommentsService productCommentsService;

    @RequestMapping(value = "detail-info/{productId}",method = RequestMethod.GET)
    public ResultVO detailInfo(@PathVariable("productId") Integer productId){
        return productService.detailInfo(productId);
    }


    @RequestMapping(value = "detail-params/{productId}",method = RequestMethod.GET)
    public ResultVO detailParams(@PathVariable("productId") Integer productId){
        return productService.detailParams(productId);
    }

    @RequestMapping(value = "detail-commonts/{productId}",method = RequestMethod.GET)
    public ResultVO detailCommonts(@PathVariable("productId") Integer productId,
                                   Integer pageNum, Integer limit){
        return productCommentsService.detailCommonts(productId,pageNum,limit);
    }

}
